﻿Imports System.Data
Imports System.Data.SqlClient
Imports Sistema_InformacionNaviera.BE
Imports Sistema_InformacionNaviera.DALC
Imports Sistema_InformacionNavier.UTIL



Public Class BillOfLadingExpoDALC


    Public Function InsertarBLExpo(ByVal objBLExpoBE As BillOfLadingExpoBE, ByRef bExito As Boolean, ByRef sMensaje As String) As Boolean

        Dim arrSqlParameter(50) As SqlParameter

        Try

            arrSqlParameter(0) = New SqlParameter()
            arrSqlParameter(0).ParameterName = "@KVJE"
            arrSqlParameter(0).SqlDbType = SqlDbType.Int
            arrSqlParameter(0).Direction = ParameterDirection.Input
            arrSqlParameter(0).Value = objBLExpoBE.KVJE

            arrSqlParameter(1) = New SqlParameter()
            arrSqlParameter(1).ParameterName = "@KBLM"
            arrSqlParameter(1).SqlDbType = SqlDbType.Int
            arrSqlParameter(1).Direction = ParameterDirection.Input
            arrSqlParameter(1).Value = objBLExpoBE.KBLM

            arrSqlParameter(2) = New SqlParameter()
            arrSqlParameter(2).ParameterName = "@TOPE"
            arrSqlParameter(2).SqlDbType = SqlDbType.Char
            arrSqlParameter(2).Size = 1
            arrSqlParameter(2).Direction = ParameterDirection.Input
            arrSqlParameter(2).Value = objBLExpoBE.TOPE

            arrSqlParameter(3) = New SqlParameter()
            arrSqlParameter(3).ParameterName = "@Nume"
            arrSqlParameter(3).SqlDbType = SqlDbType.VarChar
            arrSqlParameter(3).Size = 20
            arrSqlParameter(3).Direction = ParameterDirection.Input
            arrSqlParameter(3).Value = objBLExpoBE.Nume

            arrSqlParameter(4) = New SqlParameter()
            arrSqlParameter(4).ParameterName = "@Tibl"
            arrSqlParameter(4).SqlDbType = SqlDbType.VarChar
            arrSqlParameter(4).Size = 1
            arrSqlParameter(4).Direction = ParameterDirection.Input
            arrSqlParameter(4).Value = objBLExpoBE.Tibl

            arrSqlParameter(5) = New SqlParameter()
            arrSqlParameter(5).ParameterName = "@Lemi"
            arrSqlParameter(5).SqlDbType = SqlDbType.VarChar
            arrSqlParameter(5).Size = 3
            arrSqlParameter(5).Direction = ParameterDirection.Input
            arrSqlParameter(5).Value = objBLExpoBE.Lemi

            arrSqlParameter(6) = New SqlParameter()
            arrSqlParameter(6).ParameterName = "@Femi"
            arrSqlParameter(6).SqlDbType = SqlDbType.VarChar
            arrSqlParameter(6).Size = 10
            arrSqlParameter(6).Direction = ParameterDirection.Input
            arrSqlParameter(6).Value = objBLExpoBE.Femi

            arrSqlParameter(7) = New SqlParameter()
            arrSqlParameter(7).ParameterName = "@Emba"
            arrSqlParameter(7).SqlDbType = SqlDbType.VarChar
            arrSqlParameter(7).Size = 6
            arrSqlParameter(7).Direction = ParameterDirection.Input
            arrSqlParameter(7).Value = objBLExpoBE.Emba

            arrSqlParameter(8) = New SqlParameter()
            arrSqlParameter(8).ParameterName = "@Csne"
            arrSqlParameter(8).SqlDbType = SqlDbType.VarChar
            arrSqlParameter(8).Size = 6
            arrSqlParameter(8).Direction = ParameterDirection.Input
            arrSqlParameter(8).Value = objBLExpoBE.Csne

            arrSqlParameter(9) = New SqlParameter()
            arrSqlParameter(9).ParameterName = "@Noti"
            arrSqlParameter(9).SqlDbType = SqlDbType.VarChar
            arrSqlParameter(9).Size = 6
            arrSqlParameter(9).Direction = ParameterDirection.Input
            arrSqlParameter(9).Value = objBLExpoBE.Noti

            arrSqlParameter(10) = New SqlParameter()
            arrSqlParameter(10).ParameterName = "@Not2"
            arrSqlParameter(10).SqlDbType = SqlDbType.VarChar
            arrSqlParameter(10).Size = 6
            arrSqlParameter(10).Direction = ParameterDirection.Input
            arrSqlParameter(10).Value = objBLExpoBE.Not2

            arrSqlParameter(11) = New SqlParameter()
            arrSqlParameter(11).ParameterName = "@Fwdr"
            arrSqlParameter(11).SqlDbType = SqlDbType.VarChar
            arrSqlParameter(11).Size = 6
            arrSqlParameter(11).Direction = ParameterDirection.Input
            arrSqlParameter(11).Value = objBLExpoBE.Fwdr

            arrSqlParameter(12) = New SqlParameter()
            arrSqlParameter(12).ParameterName = "@Agad"
            arrSqlParameter(12).SqlDbType = SqlDbType.VarChar
            arrSqlParameter(12).Size = 6
            arrSqlParameter(12).Direction = ParameterDirection.Input
            arrSqlParameter(12).Value = objBLExpoBE.Agad

            arrSqlParameter(13) = New SqlParameter()
            arrSqlParameter(13).ParameterName = "@Line"
            arrSqlParameter(13).SqlDbType = SqlDbType.VarChar
            arrSqlParameter(13).Size = 3
            arrSqlParameter(13).Direction = ParameterDirection.Input
            arrSqlParameter(13).Value = objBLExpoBE.Line

            arrSqlParameter(14) = New SqlParameter()
            arrSqlParameter(14).ParameterName = "@Ptoo"
            arrSqlParameter(14).SqlDbType = SqlDbType.VarChar
            arrSqlParameter(14).Size = 3
            arrSqlParameter(14).Direction = ParameterDirection.Input
            arrSqlParameter(14).Value = objBLExpoBE.Ptoo

            arrSqlParameter(15) = New SqlParameter()
            arrSqlParameter(15).ParameterName = "@Ptoe"
            arrSqlParameter(15).SqlDbType = SqlDbType.VarChar
            arrSqlParameter(15).Size = 3
            arrSqlParameter(15).Direction = ParameterDirection.Input
            arrSqlParameter(15).Value = objBLExpoBE.Ptoe

            arrSqlParameter(16) = New SqlParameter()
            arrSqlParameter(16).ParameterName = "@Dfin"
            arrSqlParameter(16).SqlDbType = SqlDbType.VarChar
            arrSqlParameter(16).Size = 3
            arrSqlParameter(16).Direction = ParameterDirection.Input
            arrSqlParameter(16).Value = objBLExpoBE.Dfin

            arrSqlParameter(17) = New SqlParameter()
            arrSqlParameter(17).ParameterName = "@Dfi2"
            arrSqlParameter(17).SqlDbType = SqlDbType.VarChar
            arrSqlParameter(17).Size = 3
            arrSqlParameter(17).Direction = ParameterDirection.Input
            arrSqlParameter(17).Value = objBLExpoBE.Dfi2


            arrSqlParameter(18) = New SqlParameter()
            arrSqlParameter(18).ParameterName = "@Dpte"
            arrSqlParameter(18).SqlDbType = SqlDbType.VarChar
            arrSqlParameter(18).Size = 50
            arrSqlParameter(18).Direction = ParameterDirection.Input
            arrSqlParameter(18).Value = objBLExpoBE.Dpte

            arrSqlParameter(19) = New SqlParameter()
            arrSqlParameter(19).ParameterName = "@Dpto"
            arrSqlParameter(19).SqlDbType = SqlDbType.VarChar
            arrSqlParameter(19).Size = 50
            arrSqlParameter(19).Direction = ParameterDirection.Input
            arrSqlParameter(19).Value = objBLExpoBE.Dpto

            arrSqlParameter(20) = New SqlParameter()
            arrSqlParameter(20).ParameterName = "@Dptd"
            arrSqlParameter(20).SqlDbType = SqlDbType.VarChar
            arrSqlParameter(20).Size = 50
            arrSqlParameter(20).Direction = ParameterDirection.Input
            arrSqlParameter(20).Value = objBLExpoBE.Dptd

            arrSqlParameter(21) = New SqlParameter()
            arrSqlParameter(21).ParameterName = "@Ddfi"
            arrSqlParameter(21).SqlDbType = SqlDbType.VarChar
            arrSqlParameter(21).Size = 50
            arrSqlParameter(21).Direction = ParameterDirection.Input
            arrSqlParameter(21).Value = objBLExpoBE.Ddfi

            arrSqlParameter(22) = New SqlParameter()
            arrSqlParameter(22).ParameterName = "@Ddf2"
            arrSqlParameter(22).SqlDbType = SqlDbType.VarChar
            arrSqlParameter(22).Size = 50
            arrSqlParameter(22).Direction = ParameterDirection.Input
            arrSqlParameter(22).Value = objBLExpoBE.Ddf2

            arrSqlParameter(23) = New SqlParameter()
            arrSqlParameter(23).ParameterName = "@Fomt"
            arrSqlParameter(23).SqlDbType = SqlDbType.VarChar
            arrSqlParameter(23).Size = 1
            arrSqlParameter(23).Direction = ParameterDirection.Input
            arrSqlParameter(23).Value = objBLExpoBE.Fomt

            arrSqlParameter(24) = New SqlParameter()
            arrSqlParameter(24).ParameterName = "@OBSE"
            arrSqlParameter(24).SqlDbType = SqlDbType.VarChar
            arrSqlParameter(24).Size = 400
            arrSqlParameter(24).Direction = ParameterDirection.Input
            arrSqlParameter(24).Value = objBLExpoBE.OBSE

            arrSqlParameter(25) = New SqlParameter()
            arrSqlParameter(25).ParameterName = "@Tfpf"
            arrSqlParameter(25).SqlDbType = SqlDbType.VarChar
            arrSqlParameter(25).Size = 400
            arrSqlParameter(25).Direction = ParameterDirection.Input
            arrSqlParameter(25).Value = objBLExpoBE.Tfpf

            arrSqlParameter(26) = New SqlParameter()
            arrSqlParameter(26).ParameterName = "@Tfpt"
            arrSqlParameter(26).SqlDbType = SqlDbType.Float
            arrSqlParameter(26).Direction = ParameterDirection.Input
            arrSqlParameter(26).Value = objBLExpoBE.Tfpt

            arrSqlParameter(27) = New SqlParameter()
            arrSqlParameter(27).ParameterName = "@Tfcf"
            arrSqlParameter(27).SqlDbType = SqlDbType.Float
            arrSqlParameter(27).Direction = ParameterDirection.Input
            arrSqlParameter(27).Value = objBLExpoBE.Tfcf

            arrSqlParameter(28) = New SqlParameter()
            arrSqlParameter(28).ParameterName = "@Tfct"
            arrSqlParameter(28).SqlDbType = SqlDbType.Float
            arrSqlParameter(28).Direction = ParameterDirection.Input
            arrSqlParameter(28).Value = objBLExpoBE.Tfct

            arrSqlParameter(29) = New SqlParameter()
            arrSqlParameter(29).ParameterName = "@CFLE"
            arrSqlParameter(29).SqlDbType = SqlDbType.Char
            arrSqlParameter(29).Size = 1
            arrSqlParameter(29).Direction = ParameterDirection.Input
            arrSqlParameter(29).Value = objBLExpoBE.CFLE

            arrSqlParameter(30) = New SqlParameter()
            arrSqlParameter(30).ParameterName = "@Unid"
            arrSqlParameter(30).SqlDbType = SqlDbType.Int
            arrSqlParameter(30).Direction = ParameterDirection.Input
            arrSqlParameter(30).Value = objBLExpoBE.Unid

            arrSqlParameter(31) = New SqlParameter()
            arrSqlParameter(31).ParameterName = "@Csue"
            arrSqlParameter(31).SqlDbType = SqlDbType.Int
            arrSqlParameter(31).Direction = ParameterDirection.Input
            arrSqlParameter(31).Value = objBLExpoBE.Csue

            arrSqlParameter(32) = New SqlParameter()
            arrSqlParameter(32).ParameterName = "@Pkgs"
            arrSqlParameter(32).SqlDbType = SqlDbType.Int
            arrSqlParameter(32).Direction = ParameterDirection.Input
            arrSqlParameter(32).Value = objBLExpoBE.Pkgs

            arrSqlParameter(33) = New SqlParameter()
            arrSqlParameter(33).ParameterName = "@Tafle"
            arrSqlParameter(33).SqlDbType = SqlDbType.Float
            arrSqlParameter(33).Direction = ParameterDirection.Input
            arrSqlParameter(33).Value = objBLExpoBE.Tafle

            arrSqlParameter(34) = New SqlParameter()
            arrSqlParameter(34).ParameterName = "@Tathc"
            arrSqlParameter(34).SqlDbType = SqlDbType.Float
            arrSqlParameter(34).Direction = ParameterDirection.Input
            arrSqlParameter(34).Value = objBLExpoBE.Tathc

            arrSqlParameter(35) = New SqlParameter()
            arrSqlParameter(35).ParameterName = "@ESTA"
            arrSqlParameter(35).SqlDbType = SqlDbType.Bit
            arrSqlParameter(35).Direction = ParameterDirection.Input
            arrSqlParameter(35).Value = objBLExpoBE.ESTA

            arrSqlParameter(36) = New SqlParameter()
            arrSqlParameter(36).ParameterName = "@Agge"
            arrSqlParameter(36).SqlDbType = SqlDbType.VarChar
            arrSqlParameter(36).Size = 6
            arrSqlParameter(36).Direction = ParameterDirection.Input
            arrSqlParameter(36).Value = objBLExpoBE.Agge

            arrSqlParameter(37) = New SqlParameter()
            arrSqlParameter(37).ParameterName = "@Serv"
            arrSqlParameter(37).SqlDbType = SqlDbType.VarChar
            arrSqlParameter(37).Size = 3
            arrSqlParameter(37).Direction = ParameterDirection.Input
            arrSqlParameter(37).Value = objBLExpoBE.Serv

            arrSqlParameter(38) = New SqlParameter()
            arrSqlParameter(38).ParameterName = "@Norig"
            arrSqlParameter(38).SqlDbType = SqlDbType.Int
            arrSqlParameter(38).Direction = ParameterDirection.Input
            arrSqlParameter(38).Value = objBLExpoBE.Norig

            arrSqlParameter(39) = New SqlParameter()
            arrSqlParameter(39).ParameterName = "@Dtot"
            arrSqlParameter(39).SqlDbType = SqlDbType.VarChar
            arrSqlParameter(39).Size = 40
            arrSqlParameter(39).Direction = ParameterDirection.Input
            arrSqlParameter(39).Value = objBLExpoBE.Dtot

            arrSqlParameter(40) = New SqlParameter()
            arrSqlParameter(40).ParameterName = "@Lpfp"
            arrSqlParameter(40).SqlDbType = SqlDbType.VarChar
            arrSqlParameter(40).Size = 30
            arrSqlParameter(40).Direction = ParameterDirection.Input
            arrSqlParameter(40).Value = objBLExpoBE.Lpfp

            arrSqlParameter(41) = New SqlParameter()
            arrSqlParameter(41).ParameterName = "@Lpfc"
            arrSqlParameter(41).SqlDbType = SqlDbType.VarChar
            arrSqlParameter(41).Size = 30
            arrSqlParameter(41).Direction = ParameterDirection.Input
            arrSqlParameter(41).Value = objBLExpoBE.Lpfc

            arrSqlParameter(42) = New SqlParameter()
            arrSqlParameter(42).ParameterName = "@Talm"
            arrSqlParameter(42).SqlDbType = SqlDbType.VarChar
            arrSqlParameter(42).Size = 3
            arrSqlParameter(42).Direction = ParameterDirection.Input
            arrSqlParameter(42).Value = objBLExpoBE.Talm

            arrSqlParameter(43) = New SqlParameter()
            arrSqlParameter(43).ParameterName = "@Agdo"
            arrSqlParameter(43).SqlDbType = SqlDbType.VarChar
            arrSqlParameter(43).Size = 6
            arrSqlParameter(43).Direction = ParameterDirection.Input
            arrSqlParameter(43).Value = objBLExpoBE.Agdo

            arrSqlParameter(44) = New SqlParameter()
            arrSqlParameter(44).ParameterName = "@Tdes"
            arrSqlParameter(44).SqlDbType = SqlDbType.VarChar
            arrSqlParameter(44).Size = 1
            arrSqlParameter(44).Direction = ParameterDirection.Input
            arrSqlParameter(44).Value = objBLExpoBE.Tdes

            arrSqlParameter(45) = New SqlParameter()
            arrSqlParameter(45).ParameterName = "@Cond"
            arrSqlParameter(45).SqlDbType = SqlDbType.VarChar
            arrSqlParameter(45).Size = 1
            arrSqlParameter(45).Direction = ParameterDirection.Input
            arrSqlParameter(45).Value = objBLExpoBE.Cond

            arrSqlParameter(46) = New SqlParameter()
            arrSqlParameter(46).ParameterName = "@OpeLog"
            arrSqlParameter(46).SqlDbType = SqlDbType.VarChar
            arrSqlParameter(46).Size = 6
            arrSqlParameter(46).Direction = ParameterDirection.Input
            arrSqlParameter(46).Value = objBLExpoBE.OpeLog

            arrSqlParameter(47) = New SqlParameter()
            arrSqlParameter(47).ParameterName = "@CUSU"
            arrSqlParameter(47).SqlDbType = SqlDbType.VarChar
            arrSqlParameter(47).Size = 15
            arrSqlParameter(47).Direction = ParameterDirection.Input
            arrSqlParameter(47).Value = objBLExpoBE.CUSU

            arrSqlParameter(48) = New SqlParameter()
            arrSqlParameter(48).ParameterName = "@TfcfInt"
            arrSqlParameter(48).SqlDbType = SqlDbType.Float
            arrSqlParameter(48).Direction = ParameterDirection.Input
            arrSqlParameter(48).Value = objBLExpoBE.TfcfInt

            arrSqlParameter(49) = New SqlParameter()
            arrSqlParameter(49).ParameterName = "@TfctInt"
            arrSqlParameter(49).SqlDbType = SqlDbType.Float
            arrSqlParameter(49).Direction = ParameterDirection.Input
            arrSqlParameter(49).Value = objBLExpoBE.TfctInt

            arrSqlParameter(50) = New SqlParameter()
            arrSqlParameter(50).ParameterName = "@Ptod"
            arrSqlParameter(50).SqlDbType = SqlDbType.Float
            arrSqlParameter(50).Direction = ParameterDirection.Input
            arrSqlParameter(50).Value = objBLExpoBE.Ptod


            Dim oDatos As New AccesoDatos()

            oDatos.EjecutaSP("SP_BLExpo_Ins", bExito, sMensaje, arrSqlParameter)
            'sCodigo = objBLImpoBE.codPaquete
            Return bExito

        Catch ex As Exception
            Throw
        End Try

    End Function

    Public Function ConsultarBLExportacion(ByVal objBLExpoBE As BillOfLadingExpoBE) As List(Of BillOfLadingExpoBE)

        Dim sqlListar As String
        Dim objConsultaBLExpo As New List(Of BillOfLadingExpoBE)
        Dim objBlExportacionBe As BillOfLadingExpoBE = Nothing
        Dim arrSqlParameter(2) As SqlParameter
        Dim ds As DataSet
        Dim dt As DataTable

        Dim objDatos As New AccesoDatos()
        Dim blnExito As Boolean
        Dim strMensaje As String = String.Empty
        Dim intI As Integer = 0

        Try

            sqlListar = "SP_BLExpo_List"

            arrSqlParameter(0) = New SqlParameter("@Kvje", System.Data.SqlDbType.Int)
            arrSqlParameter(0).Value = objBLExpoBE.KVJE
            arrSqlParameter(1) = New SqlParameter("@Emb", System.Data.SqlDbType.VarChar)
            arrSqlParameter(1).Value = objBLExpoBE.Emba
            arrSqlParameter(2) = New SqlParameter("@Bl", System.Data.SqlDbType.VarChar)
            arrSqlParameter(2).Value = objBLExpoBE.Nume

            ds = objDatos.DevuelveDataSet(sqlListar, blnExito, strMensaje, arrSqlParameter)
            dt = ds.Tables(0)



            If dt.Rows.Count > 0 Then
                While intI < dt.Rows.Count
                    objBlExportacionBe = New BillOfLadingExpoBE()
                    objBlExportacionBe.KBLM = dt.Rows(intI).ItemArray(0).ToString
                    objBlExportacionBe.KVJE = dt.Rows(intI).ItemArray(1).ToString
                    objBlExportacionBe.desKVJE = dt.Rows(intI).ItemArray(2).ToString
                    objBlExportacionBe.Line = dt.Rows(intI).ItemArray(3).ToString
                    objBlExportacionBe.Condicion = dt.Rows(intI).ItemArray(4).ToString
                    objBlExportacionBe.Nume = dt.Rows(intI).ItemArray(5).ToString
                    objBlExportacionBe.Numero = dt.Rows(intI).ItemArray(6).ToString
                    objBlExportacionBe.Ptoo = dt.Rows(intI).ItemArray(7).ToString
                    objBlExportacionBe.Dpto = dt.Rows(intI).ItemArray(8).ToString
                    objBlExportacionBe.Ddfi = dt.Rows(intI).ItemArray(9).ToString
                    objBlExportacionBe.Csne = dt.Rows(intI).ItemArray(10).ToString
                    objBlExportacionBe.Unid = dt.Rows(intI).ItemArray(11).ToString
                    objBlExportacionBe.Emba = dt.Rows(intI).ItemArray(12).ToString
                    intI = intI + 1

                    objConsultaBLExpo.Add(objBlExportacionBe)
                End While
            End If

        Catch ex As Exception
            MsgBox(ex.Message, vbCritical, "Error del sistema")
            Return Nothing
            Exit Function
        End Try

        Return objConsultaBLExpo
    End Function

    Public Function EliminarBlExpo(ByVal objBlImpoBE As BillOfLadingExpoBE, ByRef bExito As Boolean, ByRef sMensaje As String) As Boolean

        Dim arrSqlParameter(2) As SqlParameter

        Try

            'arrSqlParameter(0) = New SqlParameter()
            'arrSqlParameter(0).ParameterName = "@Kvje"
            'arrSqlParameter(0).SqlDbType = SqlDbType.Int
            'arrSqlParameter(0).Direction = ParameterDirection.Input
            'arrSqlParameter(0).Value = objBlImpoBE.Viaje


            'arrSqlParameter(1) = New SqlParameter()
            'arrSqlParameter(1).ParameterName = "@Kbl"
            'arrSqlParameter(1).SqlDbType = SqlDbType.Int
            'arrSqlParameter(1).Direction = ParameterDirection.Input
            'arrSqlParameter(1).Value = objBlImpoBE.CodBLImpo


            'arrSqlParameter(2) = New SqlParameter()
            'arrSqlParameter(2).ParameterName = "@CUSU"
            'arrSqlParameter(2).SqlDbType = SqlDbType.VarChar 
            'arrSqlParameter(2).Direction = ParameterDirection.Input
            'arrSqlParameter(2).Value = "Sistemas"

            'Dim oDatos As New AccesoDatos()

            'oDatos.EjecutaSP("Bls_Eliminar", bExito, sMensaje, arrSqlParameter)

            'Return bExito

        Catch ex As Exception
            MsgBox(ex.Message, vbCritical, "Error del sistema")
            Return Nothing
            Exit Function
        End Try

    End Function

    Public Function ModificarBLExpo(ByVal objBLImpoBE As BillOfLadingImpoBE, ByRef bExito As Boolean, ByRef sMensaje As String) As Boolean

        'Dim arrSqlParameter(4) As SqlParameter

        'Try

        '    arrSqlParameter(0) = New SqlParameter()
        '    arrSqlParameter(0).ParameterName = "@Kvje"
        '    arrSqlParameter(0).SqlDbType = SqlDbType.Int
        '    arrSqlParameter(0).Direction = ParameterDirection.Input
        '    arrSqlParameter(0).Value = objBLImpoBE.Viaje

        '    arrSqlParameter(1) = New SqlParameter()
        '    arrSqlParameter(1).ParameterName = "@Kbl"
        '    arrSqlParameter(1).SqlDbType = SqlDbType.Int
        '    arrSqlParameter(1).Size = 50
        '    arrSqlParameter(1).Direction = ParameterDirection.Input
        '    arrSqlParameter(1).Value = objBLImpoBE.CodBLImpo

        '    arrSqlParameter(2) = New SqlParameter()
        '    arrSqlParameter(2).ParameterName = "@Tdes"
        '    arrSqlParameter(2).SqlDbType = SqlDbType.Char
        '    arrSqlParameter(2).Size = 1
        '    arrSqlParameter(2).Direction = ParameterDirection.Input
        '    arrSqlParameter(2).Value = objBLImpoBE.DescMercaderia

        '    arrSqlParameter(3) = New SqlParameter()
        '    arrSqlParameter(3).ParameterName = "@Obse"
        '    arrSqlParameter(3).SqlDbType = SqlDbType.VarChar
        '    arrSqlParameter(3).Size = 100
        '    arrSqlParameter(3).Direction = ParameterDirection.Input
        '    arrSqlParameter(3).Value = objBLImpoBE.Observaciones

        '    arrSqlParameter(4) = New SqlParameter()
        '    arrSqlParameter(4).ParameterName = "@CUSU"
        '    arrSqlParameter(4).SqlDbType = SqlDbType.VarChar
        '    arrSqlParameter(4).Size = 15
        '    arrSqlParameter(4).Direction = ParameterDirection.Input
        '    arrSqlParameter(4).Value = "Sistemas"

        '    arrSqlParameter(5) = New SqlParameter()
        '    arrSqlParameter(5).ParameterName = "@AGAD"
        '    arrSqlParameter(5).SqlDbType = SqlDbType.VarChar
        '    arrSqlParameter(5).Size = 6
        '    arrSqlParameter(5).Direction = ParameterDirection.Input
        '    arrSqlParameter(5).Value = objBLImpoBE.AgenteAduana 

        '    Dim oDatos As New AccesoDatos()

        '    oDatos.EjecutaSP("BlsImpo_ActualizarDatosImpo", bExito, sMensaje, arrSqlParameter) 
        '    Return bExito

        'Catch ex As Exception
        '    Throw
        'End Try

    End Function

    Public Function ListarDetalleMercaderia(ByVal objServicioBE As BillOfLadingImpoBE, ByRef dt As DataTable, ByRef bExito As Boolean, ByRef sMensaje As String) As List(Of BillOfLadingImpoBE)

        'Dim sqlListar As String
        'Dim objListaServicio As New List(Of ServicioBE)
        ''Dim objServicioBE As ServicioBE = Nothing
        'Dim arrSqlParameter(0) As SqlParameter
        'Dim ds As DataSet
        ''Dim dt As DataTable

        'Dim objDatos As New AccesoDatos()
        ''Dim blnExito As Boolean
        ''Dim strMensaje As String = String.Empty
        'Dim intI As Integer = 0

        'Try

        '    sqlListar = "SP_DetalleServicio_List"

        '    arrSqlParameter(0) = New SqlParameter("@CODIGO", System.Data.SqlDbType.Int)
        '    arrSqlParameter(0).Value = objServicioBE.CodServicio

        '    ds = objDatos.DevuelveDataSet(sqlListar, bExito, sMensaje, arrSqlParameter)
        '    dt = ds.Tables(0)


        '    objListaServicio = New List(Of ServicioBE)()

        '    If dt.Rows.Count > 0 Then

        '        While intI < dt.Rows.Count
        '            objServicioBE = New ServicioBE()
        '            objServicioBE.CodTarifaServProv = dt.Rows(intI).ItemArray(0).ToString
        '            objServicioBE.CodServicio = dt.Rows(intI).ItemArray(1).ToString
        '            objServicioBE.codPais = dt.Rows(intI).ItemArray(2).ToString
        '            objServicioBE.descripcionPais = dt.Rows(intI).ItemArray(3).ToString
        '            objServicioBE.codCiudad = dt.Rows(intI).ItemArray(4).ToString
        '            objServicioBE.descripcionCiudad = dt.Rows(intI).ItemArray(5).ToString
        '            objServicioBE.CodProveedor = dt.Rows(intI).ItemArray(6).ToString
        '            objServicioBE.DesProveedor = dt.Rows(intI).ItemArray(7).ToString
        '            objServicioBE.UsuarioCreador = dt.Rows(intI).ItemArray(8).ToString
        '            objServicioBE.codTipoTarifa = dt.Rows(intI).ItemArray(9).ToString
        '            objServicioBE.DescTipoTarifa = dt.Rows(intI).ItemArray(10).ToString
        '            objServicioBE.Tarifa = dt.Rows(intI).ItemArray(11).ToString
        '            objServicioBE.EstadoTarServProv = dt.Rows(intI).ItemArray(12).ToString

        '            intI = intI + 1

        '            objListaServicio.Add(objServicioBE)
        '        End While
        '    End If

        'Catch ex As Exception
        '    MsgBox(ex.Message, vbCritical, "Error del sistema")
        '    Return Nothing
        '    Exit Function
        'End Try

        'Return objListaServicio
    End Function

    'Public Function ObtieneBLImpo(ByVal objBLImpoBE As BillOfLadingImpoBE, ByRef bExito As Boolean, ByRef sMensaje As String) As List(Of BillOfLadingExpoBE)

    '    Dim sqlListar As String
    '    Dim objConsultaBLImpo As New List(Of BillOfLadingImpoBE)
    '    Dim objBlImportacionBe As BillOfLadingImpoBE = Nothing
    '    Dim arrSqlParameter(1) As SqlParameter
    '    Dim ds As DataSet
    '    Dim dt As DataTable

    '    Dim objDatos As New AccesoDatos()
    '    Dim blnExito As Boolean
    '    Dim strMensaje As String = String.Empty
    '    Dim intI As Integer = 0

    '    Try

    '        sqlListar = "dbo.SP_1BlsCabecera_Obt"

    '        arrSqlParameter(0) = New SqlParameter("@Kvje", System.Data.SqlDbType.Int)
    '        arrSqlParameter(0).Value = objBLImpoBE.KVJE
    '        arrSqlParameter(1) = New SqlParameter("@NumBl", System.Data.SqlDbType.Int)
    '        arrSqlParameter(1).Value = objBLImpoBE.KBLM

    '        ds = objDatos.DevuelveDataSet(sqlListar, blnExito, strMensaje, arrSqlParameter)
    '        dt = ds.Tables(0)


    '        If dt.Rows.Count > 0 Then
    '            While intI < dt.Rows.Count
    '                objBlImportacionBe = New BillOfLadingImpoBE()
    '                objBlImportacionBe.KVJE = dt.Rows(intI).ItemArray(0).ToString
    '                objBlImportacionBe.KBLM = dt.Rows(intI).ItemArray(1).ToString
    '                objBlImportacionBe.CodEmbarcador = dt.Rows(intI).ItemArray(2).ToString
    '                objBlImportacionBe.Embarcador = dt.Rows(intI).ItemArray(3).ToString
    '                objBlImportacionBe.CodConsignatario = dt.Rows(intI).ItemArray(4).ToString
    '                objBlImportacionBe.Consignatario = dt.Rows(intI).ItemArray(5).ToString
    '                objBlImportacionBe.CodNotificante = dt.Rows(intI).ItemArray(6).ToString
    '                objBlImportacionBe.Notificante = dt.Rows(intI).ItemArray(7).ToString
    '                objBlImportacionBe.CodBLImpo = dt.Rows(intI).ItemArray(8).ToString
    '                objBlImportacionBe.Numero = dt.Rows(intI).ItemArray(9).ToString
    '                objBlImportacionBe.LugarEmision = dt.Rows(intI).ItemArray(10).ToString
    '                objBlImportacionBe.Tipo = dt.Rows(intI).ItemArray(11).ToString
    '                objBlImportacionBe.FechaEmision = dt.Rows(intI).ItemArray(12).ToString
    '                objBlImportacionBe.NroOrigen = dt.Rows(intI).ItemArray(13).ToString
    '                objBlImportacionBe.FullConsEmpty = dt.Rows(intI).ItemArray(14).ToString
    '                objBlImportacionBe.Line = dt.Rows(intI).ItemArray(15).ToString
    '                objBlImportacionBe.AgenteAduana = dt.Rows(intI).ItemArray(16).ToString
    '                objBlImportacionBe.AgenteAduanaDesc = dt.Rows(intI).ItemArray(17).ToString
    '                objBlImportacionBe.AgenteDocum = dt.Rows(intI).ItemArray(18).ToString
    '                objBlImportacionBe.Servicio = dt.Rows(intI).ItemArray(19).ToString
    '                objBlImportacionBe.OperadorLogistico = dt.Rows(intI).ItemArray(20).ToString
    '                objBlImportacionBe.OperadorLogisticoDesc = dt.Rows(intI).ItemArray(21).ToString
    '                objBlImportacionBe.PuertoOrigen = dt.Rows(intI).ItemArray(22).ToString
    '                objBlImportacionBe.PuertoOrigenDesc = dt.Rows(intI).ItemArray(23).ToString
    '                objBlImportacionBe.PuertoEmbarque = dt.Rows(intI).ItemArray(24).ToString
    '                objBlImportacionBe.PuertoEmbarqueDesc = dt.Rows(intI).ItemArray(25).ToString
    '                objBlImportacionBe.PuertoDescarga = dt.Rows(intI).ItemArray(26).ToString
    '                objBlImportacionBe.PuertoDescargaDesc = dt.Rows(intI).ItemArray(27).ToString
    '                objBlImportacionBe.DestionFinal = dt.Rows(intI).ItemArray(28).ToString
    '                objBlImportacionBe.DestionFinalDesc = dt.Rows(intI).ItemArray(29).ToString
    '                objBlImportacionBe.AgenteGeneral = dt.Rows(intI).ItemArray(30).ToString
    '                objBlImportacionBe.AgenteGeneralDesc = dt.Rows(intI).ItemArray(31).ToString
    '                intI = intI + 1

    '                objConsultaBLImpo.Add(objBlImportacionBe)
    '            End While
    '        End If

    '    Catch ex As Exception
    '        MsgBox(ex.Message, vbCritical, "Error del sistema")
    '        Return Nothing
    '        Exit Function
    '    End Try

    '    'Return objConsultaBLImpo
    'End Function

    'Public Function ObtieneBLExpo(ByVal objBLImpoBE As BillOfLadingExpoBE, ByRef bExito As Boolean, ByRef sMensaje As String) As List(Of BillOfLadingExpoBE)

    '    Dim sqlListar As String
    '    Dim objConsultaBLImpo As New List(Of BillOfLadingImpoBE)
    '    Dim objBlImportacionBe As BillOfLadingImpoBE = Nothing
    '    Dim arrSqlParameter(1) As SqlParameter
    '    Dim ds As DataSet
    '    Dim dt As DataTable

    '    Dim objDatos As New AccesoDatos()
    '    Dim blnExito As Boolean
    '    Dim strMensaje As String = String.Empty
    '    Dim intI As Integer = 0

    '    Try

    '        sqlListar = "dbo.up_ListarBLImpo"

    '        arrSqlParameter(0) = New SqlParameter("@Kvje", System.Data.SqlDbType.Int)
    '        arrSqlParameter(0).Value = objBLImpoBE.Viaje
    '        arrSqlParameter(1) = New SqlParameter("@NumBl", System.Data.SqlDbType.Int)
    '        arrSqlParameter(1).Value = objBLImpoBE.CodBLImpo

    '        ds = objDatos.DevuelveDataSet(sqlListar, blnExito, strMensaje, arrSqlParameter)
    '        dt = ds.Tables(0)




    '        If dt.Rows.Count > 0 Then
    '            While intI < dt.Rows.Count
    '                objBlImportacionBe = New BillOfLadingImpoBE()
    '                objBlImportacionBe.Viaje = dt.Rows(intI).ItemArray(0).ToString
    '                objBlImportacionBe.ViajeDes = dt.Rows(intI).ItemArray(1).ToString
    '                objBlImportacionBe.CodEmbarcador = dt.Rows(intI).ItemArray(2).ToString
    '                objBlImportacionBe.Embarcador = dt.Rows(intI).ItemArray(3).ToString
    '                objBlImportacionBe.CodConsignatario = dt.Rows(intI).ItemArray(4).ToString
    '                objBlImportacionBe.Consignatario = dt.Rows(intI).ItemArray(5).ToString
    '                objBlImportacionBe.CodNotificante = dt.Rows(intI).ItemArray(6).ToString
    '                objBlImportacionBe.Notificante = dt.Rows(intI).ItemArray(7).ToString
    '                objBlImportacionBe.CodBLImpo = dt.Rows(intI).ItemArray(8).ToString
    '                objBlImportacionBe.Numero = dt.Rows(intI).ItemArray(9).ToString
    '                objBlImportacionBe.LugarEmision = dt.Rows(intI).ItemArray(10).ToString
    '                objBlImportacionBe.Tipo = dt.Rows(intI).ItemArray(11).ToString
    '                objBlImportacionBe.FechaEmision = dt.Rows(intI).ItemArray(12).ToString
    '                objBlImportacionBe.NroOrigen = dt.Rows(intI).ItemArray(13).ToString
    '                objBlImportacionBe.FullConsEmpty = dt.Rows(intI).ItemArray(14).ToString
    '                objBlImportacionBe.Line = dt.Rows(intI).ItemArray(15).ToString
    '                objBlImportacionBe.AgenteAduana = dt.Rows(intI).ItemArray(16).ToString
    '                objBlImportacionBe.AgenteAduanaDesc = dt.Rows(intI).ItemArray(17).ToString
    '                objBlImportacionBe.AgenteDocum = dt.Rows(intI).ItemArray(18).ToString
    '                objBlImportacionBe.Servicio = dt.Rows(intI).ItemArray(19).ToString
    '                objBlImportacionBe.OperadorLogistico = dt.Rows(intI).ItemArray(20).ToString
    '                objBlImportacionBe.OperadorLogisticoDesc = dt.Rows(intI).ItemArray(21).ToString
    '                objBlImportacionBe.PuertoOrigen = dt.Rows(intI).ItemArray(22).ToString
    '                objBlImportacionBe.PuertoOrigenDesc = dt.Rows(intI).ItemArray(23).ToString
    '                objBlImportacionBe.PuertoEmbarque = dt.Rows(intI).ItemArray(24).ToString
    '                objBlImportacionBe.PuertoEmbarqueDesc = dt.Rows(intI).ItemArray(25).ToString
    '                objBlImportacionBe.PuertoDescarga = dt.Rows(intI).ItemArray(26).ToString
    '                objBlImportacionBe.PuertoDescargaDesc = dt.Rows(intI).ItemArray(27).ToString
    '                objBlImportacionBe.DestionFinal = dt.Rows(intI).ItemArray(28).ToString
    '                objBlImportacionBe.DestionFinalDesc = dt.Rows(intI).ItemArray(29).ToString
    '                objBlImportacionBe.AgenteGeneral = dt.Rows(intI).ItemArray(30).ToString
    '                objBlImportacionBe.AgenteGeneralDesc = dt.Rows(intI).ItemArray(31).ToString
    '                intI = intI + 1

    '                objConsultaBLImpo.Add(objBlImportacionBe)
    '            End While
    '        End If

    '    Catch ex As Exception
    '        MsgBox(ex.Message, vbCritical, "Error del sistema")
    '        Return Nothing
    '        Exit Function
    '    End Try

    '    'Return objConsultaBLImpo
    'End Function

End Class
